<?php
// +----------------------------------------------------------------------
// |
// +----------------------------------------------------------------------
// |
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// |
// +----------------------------------------------------------------------

namespace app\model;

use \think\Model;

class GoodsContentGoods extends Model
{
    protected $name = 'goods_content_goods';
    protected $autoWriteTimestamp = true;
    protected $insert = [];
    protected $update = [];

    public function goods()
    {
        return $this->belongsTo(Goods::class, 'goods_id')
            ->bind([
                'title'      => 'title',
                'image'      => 'image',
                'sale_price' => 'sale_price',
                'commission' => 'commission',
                'head_imgs'  => 'head_imgs',
                'share_text' => 'share_text',
                'product_id' => 'product_id',
                'shop_appid' => 'shop_appid',
            ]);
    }

    public function category()
    {
        return $this->belongsTo(GoodsContentCategory::class, 'category_id')
            ->bind([
                'category_name' => 'title',
            ]);
    }
}
